﻿using LY.Entity;
using LY.Entity.Entities;
using LY.Entity.PageSearch;
using LY.Entity.SearchEntity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LY.Interface
{
    /// <summary>
    /// 签到和积分
    /// </summary>
    public interface IScoreService
    {
        /// <summary>
        /// 根据条件获得检索结果
        /// </summary>
        /// <param name="search">条件</param>
        /// <param name="view">search</param>
        /// <returns>返回member集合</returns>
        PagedList<U_Score_EX> QueryScoreList(ScoreSearch search, PageView view);
        /// <summary>
        /// 编辑、添加 会员信息
        /// </summary>
        /// <param name="score"></param>
        /// <returns></returns>
        int SaveScore(U_Score score);
        /// <summary>
        /// 根据编号获得单个积分对象
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        U_Score GetScore(int? id);
        List<U_Score> GetScoreByMemeberId(int? memberid);
        /// <summary>
        /// 删除积分
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        int DeleteScore(int? id);
        /// <summary>
        /// 新增积分
        /// </summary>
        /// <param name="score"></param>
        /// <returns></returns>
        int AddScore(U_Score score);

        //检验今天有没有签过到
        int CheckSignUpToday(int memberId);

        //获得最新的积分
        U_Score GetLastScoreByMemberId(int myMemberId);

        //会员积分
        int GetScoreByMID(int memberId);


        #region 积分规则
        int SaveScoreSetting(U_ScoreSetting scoreSetting);
        PagedList<U_ScoreSetting> QueryScoreSettingList(ScoreSearch search, PageView view);
        U_ScoreSetting GetScoreSetting(int? id);
        U_ScoreSetting GetScoreSetting(string name);
        #endregion
        /// <summary>
        /// 新增积分
        /// </summary>
        /// <param name="p1">积分类型</param>
        /// <param name="p2">会员ID</param>
        int SaveScore(string p1, int p2);
        int SaveScore(string p1, int p2, int Score);

        #region 签到
        /// <summary>
        /// 检测当天是否登陆
        /// </summary>
        /// <param name="memberid">用户ID</param>
        /// <returns></returns>
        bool Ischeck(int memberid);

        /// <summary>
        /// 保存签到记录
        /// </summary>
        /// <param name="check"></param>
        /// <returns></returns>
        int SaveCheck(U_Check check);
        PagedList<U_Check> QueryCheckList(CheckSearch search, PageView view);
        U_Check GetLastCheck(int memberid);
        List<U_Check_EX> QueryCheckList(string mid, int year, int month);
        #endregion

        #region 抽奖
        int SavePrize(T_Prize prize, int awardId);
        #endregion

        /// <summary>
        /// 中奖名单
        /// </summary>
        /// <returns></returns>
        List<T_Prize> GetPrizeList();

        /// <summary>
        /// 抽奖记录
        /// </summary>
        /// <param name="view"></param>
        /// <param name="search"></param>
        /// <returns></returns>
        PagedList<T_Prize> MyLottery(PageView view, T_PrizeSearch search);


        /// <summary>
        /// 奖品列表
        /// </summary>
        /// <returns></returns>
        List<T_Award> GetAwardList();
    }
}
